RC-9 : Port S8714 to python: Dedicated exception assertions should be used instead of "try-catch" with "fail()"#2292
Conversation
Code Review ✅ Approved 2 resolved / 2 findingsImplements rule S8714 to enforce dedicated exception assertions in tests, resolving issues where the rule previously ignored its own noncompliant examples and provided misleading messages in multi-except blocks. ✅ 2 resolved✅ Bug: Rule misses its own documented noncompliant examples
✅ Edge Case: NO_EXCEPTION message misleads when extra except clauses exist
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Summary by Gitar
DedicatedExceptionAssertionCheck(S8714) to flagtry-exceptblocks paired withfail()calls in tests.OpenSourceCheckListand enabled the rule in bothSonar_way_profileandSonar_agentic_AI_profile.S8714.jsonandS8714.htmldetailing noncompliant vs. compliant patterns forpytestandunittest.dedicatedExceptionAssertion.pyto test various scenarios andDedicatedExceptionAssertionCheckTestfor validation.This will update automatically on new commits.